package com.pt25.study.example.domain.sharding.service.impl;

import com.pt25.study.example.domain.sharding.ddo.ShardingSdst;
import com.pt25.study.example.domain.sharding.factory.ShardingFactory;
import com.pt25.study.example.domain.sharding.service.ShardingSdstService;
import com.pt25.study.example.repository.sharding.persistence.ShardingSdstRepo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ShardingSdstServiceImpl implements ShardingSdstService {

    @Resource
    private ShardingFactory shardingFactory;

    @Resource
    private ShardingSdstRepo shardingSdstRepo;

    @Override
    public ShardingSdst getShardingSDST(Long id) {
        return shardingSdstRepo.getShardingSdst(id);
    }

    @Override
    public void addShardingSdst(ShardingSdst shardingSdst) {
        shardingSdstRepo.save(shardingFactory.ShardingSdst2ShardingSdstPo(shardingSdst));
    }
}
